Memory system

ABSTRACT

A memory system includes a management-information restoring unit. The management-information restoring unit determines whether a short break has occurred referring to a pre-log or a post-log in a NAND memory. The management-information restoring unit determines that a short break has occurred when the pre-log or the post-log is present in the NAND memory. In that case, the management-information restoring unit determines timing of occurrence of the short break, and, after selecting a pre-log or a post-log used for restoration, performs restoration of the management information reflecting these logs on a snapshot. Thereafter, the management-information restoring unit applies recovery processing to all write-once blocks in the NAND memory, takes the snapshot again, and opens the snapshot and the logs in the past.

TECHNICAL FIELD

The present invention relates to a memory system employing a nonvolatilesemiconductor storage device.

BACKGROUND ART

Some personal computers (PC) employ a hard disk device as a secondarystorage device. In such PCs, a technology is known for backing up datathat has been stored in the hard disk device to prevent the data frombecoming invalid because of some failure. For example, when act ofchanging data in the hard disk device is detected, a snapshot as abackup copy of the data before the change is taken and a log of changesmade to the data is generated. Then, processing for taking a newsnapshot, invalidating a log taken in the past before the new snapshotwas taken, and generating a new log is repeated at every predeterminedtime (see, for example, US Patent Application Publication No.2006/0224636). In case data becomes invalid due to some reason, the datacan be restored by referring to the snapshot and the log.

In recent years, a capacity of a NAND flash memory as a nonvolatilesemiconductor storage device has been increased dramatically. As aresult, PCs including a memory system having the NAND flash memory as asecondary storage device have been put to practical use. However, thetechnology disclosed in US Patent Application Publication No.2006/0224636 cannot be applied to backup of data stored in such apersonal computer having the NAND flash memory as the secondary storagedevice as in the case of backup of data stored in the personal computerhaving the hard disk device as the secondary storage device. This isbecause a multi-value memory technology that can store a plurality ofdata (multi-value data) equal to or larger than 2 bits in one memorycell is employed to increase the capacity of the NAND flash memory.

A memory cell configuring a multi-value memory has a field effecttransistor structure having a stacked gate structure in which a gateinsulating film, a floating gate electrode, an inter-gate insulatingfilm, and a control gate electrode are stacked in order on a channelregion and a plurality of threshold voltages can be set according to thenumber of electrons accumulated in the floating gate electrode. In orderto make it possible to perform multi-value storage based on theplurality of threshold voltages, the distribution of a threshold voltagecorresponding to one data needs to be made extremely narrow.

For example, as a multi-value memory that can store four values, thereis a multi-value memory that includes a lower order page and a higherorder page in one memory cell and stores 2 bits (four values) by writing1-bit data in the respective pages. In a method of writing data in sucha multi-value memory, after data is written in a lower order page of afirst memory cell, data is written in a lower order page of a memorycell (a second memory cell) that is adjacent to the first memory cell.After data is written in this adjacent memory cell, data is written in ahigher order page of the first memory cell (see, for example, JP-A2004-192789 (KOKAI)).

However, in such a multi-value memory, a threshold voltage of the firstmemory cell in which data has been written earlier fluctuates because ofa threshold voltage of the second memory cell in which the data iswritten later and that is adjacent to the first memory cell. Therefore,in the multi-value memory, it is likely that lower order page breakageoccurs in which, if writing is suspended because of, for example,abnormal isolation of a power supply while data is being written in ahigher order page of a certain memory cell, data in a lower order pagein which the data is written earlier is also broken.

Therefore, in the personal computer employing the NAND flash memory, forexample, when the memory system is reset from the abnormal isolation ofthe power supply or the like, it is necessary to reset the memory systemto a state before the abnormal isolation occurs by distinguishing timingof the suspension or, when the wiring is suspended during writing of alog, distinguishing presence or absence of log breakage and selecting alog not affected by the suspension and reflecting the log on a snapshot.However, even if such restoration processing is performed, the brokenlog is still present. Therefore, there is a problem in that likelihoodthat the broken log is read by mistake after the resetting cannot beeliminated and reliability of the memory system is not secured.

In the memory system having the NAND flash memory, when data is stored,it is necessary to once erase a writing area, for example, in a unitcalled block and thereafter perform writing in a unit called page. Onthe other hand, when data is stored, it is necessary to once erase awriting area in, for example, a unit called block and then performwriting in a unit called page. On the other hand, there is a problem inthat, as the number of times of erasing for a block performed prior tosuch writing of the data, deterioration in a memory cell configuring theblock worsens. In other words, there is a limit in the rewritable numberof times of respective blocks. Therefore, suppression of the number oftimes of erasing of the blocks is indispensable for an extension of thedurable life of the memory system. As one of measures against such aproblem, for example, processing called wear leveling for dispersingupdate portions of data as equally as possible is performed such thatthe numbers of times of erasing of all the blocks in the memory systemare substantially equal.

When a signal for standby, sleep, or reset is generated in the personalcomputer or the like, in the conventional method for storing thesnapshot and the log, the snapshot is taken before the memory systemshifts to a designated state. For example, when the standby signal isreceived, management information concerning the memory system is storedby taking the snapshot again. Subsequently, the memory system shifts toa standby state. After the memory system is reset from the standbystate, the management information is restored by using the storedsnapshot. The memory system is restored to a state before the shift tothe standby state based on this management information.

When the method of taking the snapshot again every time the standbysignal or the like is received is applied the memory system having theNAND flash memory, there is a problem in that the durable life of thememory system is reduced according to an increase in the number of timesof acquisition of the snapshot. This is because, in acquiring thesnapshot, since a block as a storage area for management information iserased first and then the management information is written in theblock, the memory cell is deteriorated by the erasing of the block. Whenthe memory cell shifts to the standby state after the standby signal orthe like is received and the snapshot is taken again, since it takestime to create the snapshot, there is a problem in that waiting timeuntil the shift to the standby state or the like is long.

DISCLOSURE OF INVENTION

According to an aspect of the present invention, there is provided amemory system including a volatile first storing unit; a nonvolatilesecond storing unit including a memory cell that can store multi-valuedata; and a controller that performs data transfer between a hostapparatus and the second storing unit via the first storing unit, storesmanagement information including a storage position of the data storedin the second storing unit during a startup operation of the memorysystem into the first storing unit, and performs, while updating storedmanagement information, data management in the first and second storingunits based on the stored management information. The controllerincludes a management-information storing unit that stores, when apredetermined condition is satisfied, the management information storedin the first storing unit in the second storing unit as a snapshot andstores a log as update difference information of the managementinformation in the second storing unit; and a management-informationrestoring unit that takes, when the log is present in the second storingunit when starting the startup operation, the snapshot again and storesthe snapshot in the second storing unit after performing restoration ofthe management information in the first storing unit based on thesnapshot and the log.

According to another aspect of the present invention, there is provideda memory system including a volatile first storing unit; a nonvolatilesecond storing unit including a memory cell that can store multi-valuedata; and a controller that performs data transfer between a hostapparatus and the second storing unit via the first storing unit, storesmanagement information including a storage position of the data storedin the second storing unit during a startup operation of the memorysystem into the first storing unit, and performs, while updating storedmanagement information, data management in the first and second storingunits based on the stored management information. The controllerincludes a management-information storing unit that stores, when apredetermined condition is satisfied, the management information storedin the first storing unit in the second storing unit as a snapshot andstores a log as update difference information of the managementinformation in the second storing unit; and a management-informationrestoring unit that performs, when the log is present in the secondstoring unit when starting the startup operation, restoration of themanagement information in the first storing unit based on the snapshotand the log and performs, when the log is not present in the secondstoring unit when starting the startup operation, restoration of themanagement information in the first storing unit based on the snapshot.The management-information storing unit determines, when a signal fromamong a standby signal, a sleep signal, and a reset signal is received,whether the snapshot should be taken again before shifting to adesignated state designated by the signal.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram of an example of a configuration of a memorysystem according to an embodiment of the present invention;

FIG. 2 is a circuit diagram of an example of a configuration of anarbitrary block of a NAND memory;

FIG. 3A is a schematic diagram of a functional configuration of a DRAMand FIG. 3B is a schematic diagram of a functional configuration of theNAND memory;

FIG. 4 is a diagram of an example of a layer structure for managing datastored in the memory system;

FIG. 5 is a diagram of an example of a cache management informationtable;

FIG. 6 is a diagram of an example of a logical NAND managementinformation table;

FIG. 7 is a diagram of an example of an intra-NAND logical-physicalconversion information table;

FIG. 8 is a schematic diagram of an example of contents of managementinformation storage information stored in a management informationstorage area;

FIG. 9 depicts an example of a log;

FIG. 10 is a block diagram of an example of a functional configurationof a drive control unit shown in FIG. 1;

FIG. 11 is a block diagram of an example of a functional configurationof a data managing unit shown in FIG. 10;

FIG. 12 is a flowchart of an example of a storage processing procedurefor management information of the memory system;

FIG. 13 is a diagram for explaining storage processing for a pre-log anda post-log;

FIG. 14 is a flowchart of an example of a restoration processingprocedure for management information of the memory system;

FIGS. 15A to 15D are diagrams of examples of a relation between data ina memory cell and a threshold voltage of the memory cell and order ofwriting in a NAND memory;

FIGS. 16A to 16D are diagrams (1) for explaining a selection method forlogs used for restoration of management information;

FIGS. 17E to 17G are diagrams (2) for explaining the selection methodfor logs used for restoration of management information;

FIG. 18 is a schematic diagram of another example of contents of themanagement information storage information stored in the managementinformation storage area;

FIGS. 19A and 19B are timecharts of shifting to a standby state withouttaking a snapshot again and shifting to the standby state after takingthe snapshot again when a standby signal is received;

FIG. 20 is a diagram of a state in which a log is stored in page unitsin a log storing block; and

FIG. 21 is a flowchart for explaining operations of amanagement-information storing unit illustrated in FIG. 11 duringstandby, sleep, or reset.

BEST MODE(S) FOR CARRYING OUT THE INVENTION

Exemplary embodiments of memory systems according to the presentinvention are explained in detail below with reference to theaccompanying drawings. The present invention is not limited by thisembodiment.

First Embodiment

A memory system according to a first embodiment of the present inventionincludes a nonvolatile semiconductor storage device and is used as asecondary storage device (SSD: Solid State Drive) of a host apparatussuch as a personal computer. The memory system has a function of storingdata requested by a host apparatus to be written and reading out datarequested by the host apparatus to be read out and outputting the datato the host apparatus. FIG. 1 is a block diagram of an example of aconfiguration of a memory system 10 according to the first embodiment ofthe present invention. This memory system 10 includes a DRAM (DynamicRandom Access Memory) 11 as a first storing unit, a NAND flash memory(hereinafter, “NAND memory”) 12 as a second storing unit, a power supplycircuit 13, and a drive control unit 14.

The DRAM 11 is used as a storing unit for data transfer, managementinformation recording, or a work area. Specifically, when the DRAM 11 isused as a storing unit for data transfer, the DRAM 11 is used fortemporarily storing data requested by the host apparatus to be writtenbefore the data is written in the NAND memory 12, and the DRAM 11 isused to read out data requested by the host apparatus to be read outfrom the NAND memory 12 and temporarily storing the read data. When theDRAM 11 is used as a storing unit for management information recording,the DRAM 11 is used for storing management information for managingstorage positions of data stored in the DRAM 11 and the NAND memory 12.When the DRAM 11 is used as a storing unit for a work area, the DRAM 11is used, for example, during expansion of pre and post logs (apre-update log and a post-update log) used when management informationis restored.

The NAND memory 12 is used as a storing unit for storing therein data.Specifically, the NAND memory 12 stores therein data designated by thehost apparatus and stores therein, for backup, management informationmanaged by the DRAM 11. In FIG. 1, the NAND memory 12 that includes fourchannels 120A to 120D has been shown as an example. Each of the channels120A to 120D includes two packages 121 each including eight chips 122having a storage capacity of a predetermined size (e.g., 2 GB). Thechannels 120A to 120D are connected via the drive control unit 14 andbuses 15A to 15D.

The power supply circuit 13 receives external power supply and generatesa plurality of internal power supplies to be supplied to respectiveunits of the memory system 10 from the external power supply. The powersupply circuit 13 detects a state of the external power supply, i.e., arising edge or a falling edge, generates a power-on reset signal basedon the detected state, and outputs the power-on reset signal to thedrive control unit 14.

The drive control unit 14 controls the DRAM 11 and the NAND memory 12.As explained in detail later, for example, the drive control unit 14performs restoration processing for management information and storageprocessing for management information according to the power-on resetsignal from the power supply circuit 13. The drive control unit 14transmits and receives data to and from a host apparatus via an ATAinterface (I/F) and transmits and receives data to and from a debuggingapparatus via an RS232C I/F. Furthermore, the drive control unit 14outputs a control signal for controlling on/off of an LED for statedisplay provided on the outside of the memory system 10.

A configuration of the NAND memory 12 is explained in detail below. TheNAND memory 12 is configured by arraying a plurality of blocks (erasingunit areas), which are units of data erasing, on a substrate. FIG. 2 isa circuit diagram of an example of a configuration of an arbitrary blockof the NAND memory 12. In FIG. 2, left-right direction is set as an Xdirection and a direction perpendicular to the X direction is set as a Ydirection.

Each block BLK of the NAND memory 12 includes (m+1) (m is an integerequal to or larger than 0) NAND strings NS arrayed in order along the Xdirection. Each NAND string NS has (n+1) (n is an integer equal to orlarger than 0) memory cell transistors MT0 to MTn that share a diffusionregion (a source region or a drain region) between memory celltransistors MT adjacent to each other in the Y direction. Moreover, thememory cell transistors MT0 to MTn are connected in series in the Ydirection. In addition, selection transistors ST1 and ST2 arranged atboth ends of a row of the (n+1) memory transistors MT0 to MTn.

Each memory cell transistors MT0 to MTn is a MOSFET (Metal OxideSemiconductor Field Effect Transistor) having a stacked gate structureformed on a semiconductor substrate. The stacked gate structure includesa charge accumulation layer (a floating gate electrode) formed on thesemiconductor substrate via a gate insulating film and a control gateelectrode formed on the charge accumulating layer via an inter-gateinsulating film. Moreover, the memory cell transistors MT0 to MTn aremulti-value memories in which a threshold voltage changes according tothe number of electrons accumulated in the floating gate electrode and 2or more bit data can be stored depending on the difference in thethreshold voltage. In the first embodiment, it is assumed that a memorycell transistor MT is the multi-value memory.

Word lines WL0 to WLn are respectively connected to the control gateelectrodes of the memory cell transistors MT0 to MTn of each NAND stringNS. Memory cell transistors MTi (i=0 to n) in each of the NAND stringsNS are connected in common by the same word lines (i=0 to n). In otherwords, the control gate electrodes of the memory cell transistors MTipresent on the same row in the block BLK are connected to the same wordline WLi. A group of (m+1) memory cell transistors MT1 connected to thesame word line WLi are a unit forming one page. In the NAND memory 12,writing and readout of data are performed in this page unit.

Bit lines BL0 to BLm are respectively connected to drains of the (m+1)selection transistors ST1 in one block BLK. A selection gate line SGD isconnected in common to gates of the selection transistors ST1 of eachNAND string NS. Sources of the selection transistors ST1 are connectedto drains of the memory cell transistors MT0. Similarly, a source lineSL is connected in common to sources of the (m+1) selection transistorsST2 in one block BLK. A selection gate line SGS is connected in commonto gates of the selection transistors ST2 of each NAND string NS. Drainsof the selection transistors ST2 are connected to sources of the memorycell transistors MTn.

Although not shown in the figure, bit lines BLj (j=0 to m) in one blockBLK connect drains of the selection transistors ST1 in common betweenbit lines BLj of other blocks BLK. In other words, the NAND strings NSin the same column in the blocks BLK are connected by the same bit lineBLj.

Functional configurations of the DRAM 11 and the NAND memory 12 areexplained next. FIG. 3A is a schematic diagram of a functionalconfiguration of the DRAM 11 and FIG. 3B is a schematic diagram of afunctional configuration of the NAND memory 12. As shown in FIG. 3A, theDRAM 11 includes a write cache area in which data requested by the hostapparatus to be written is stored, a read cache area RC in which datarequested by the host apparatus to be read out is stored, a temporarystorage area 111 in which management information for managing storagepositions of data stored in the DRAM 11 and the NAND memory 12 isstored, and a work area 112 used when the management information isrestored.

As shown in FIG. 3B, the NAND memory 12 includes a data storage area 125in which data requested by the host apparatus to be written is storedand a management information storage area 126 in which the managementinformation managed in the temporary storage area 111 of the DRAM 11 isstored. In this example, a data writing and readout unit in the NANDmemory 12 is set as a page size unit. An erasing unit is set as a blocksize unit. Therefore, an area for storing respective blocks of the NANDmemory 12 managed in block size units is further divided into areas ofpage size units.

The management information managed in the temporary storage area 111 ofthe DRAM 11 is explained below. FIG. 4 is a diagram of an example of alayer structure for managing data stored in the memory system 10. It isassumed here that this data is the data requested by the host apparatusto be written or read out. In the memory system 10, data management isperformed by a three-layer structure: a DRAM management layer 31, alogical NAND management layer 32, and a physical NAND management layer33. The DRAM management layer 31 performs data management in the DRAM 11that plays a role of a cache. The logical NAND management layer 32performs logical data management in the NAND memory 12. The physicalNAND management layer 33 performs physical data management in the NANDmemory 12, life extension processing for the NAND memory 12, and thelike.

In the write cache area WC and the read cache area RC of the DRAM 11,data designated by a logical address (hereinafter, “LBA (Logical BlockAddress)”) managed by an address managing method of the host apparatusis stored in a physical address in a predetermined range on the DRAM 11(hereinafter, “intra-DRAM physical address). Data in the DRAM managementlayer 31 is managed by cache management information 41 including acorrespondence relation between an LBA of data to be stored and theintra-DRAM physical address and a sector flag indicating presence orabsence of data in sector size units in a page.

FIG. 5 illustrates an example of the cache management information 41 intabular manner. The cache management information 41 is one entry for onearea of a one page size of the DRAM 11. The number of entries is equalto or smaller than the number of pages that fit in the write cache areaWC and the read cache area RC. In each of the entries, the LBA of dataof a page size, the intra-DRAM physical address, and a sector flagindicating a position of valid data in each of areas obtained bydividing this page by a sector size are associated.

In the NAND memory 12, data from the DRAM 11 is stored in a physicaladdress in a predetermined range (hereinafter, “intra-NAND physicaladdress) on the NAND memory 12. In the NAND memory 12 formed by themulti-value memory, because the number of rewritable times is limited,the numbers of times of rewriting among the blocks configuring the NANDmemory 12 are controlled by the drive control unit 14 to be equalized.In other words, when update of data written in a certain intra-NANDphysical address in the NAND memory 12 is performed, the drive controlunit 14 performs control to equalize the numbers of times of rewritingamong the blocks configuring the NAND memory 12 to write, in a blockdifferent from the original block, data reflecting a portion required tobe updated of a block in which the data to be updated is included andinvalidate the original block.

As explained above, in the NAND memory 12, processing units aredifferent in the writing and readout processing for data and the erasingprocessing for data. In the update processing for data, a position (ablock) of data before update and a position (a block) of data afterupdate are different. Therefore, in the first embodiment, an intra-NANDlogical address used independently in the NAND memory 12 (hereinafter,“intra-NAND logical address”) is provided besides the intra-NANDphysical address.

Therefore, data in the logical NAND management layer 32 is managed bylogical NAND management information 42 indicating a relation between anLBA of data in page size units received from the DRAM 11 and anintra-NAND logical address indicating a logical page position of theNAND memory 12 in which the received data is stored and a relationindicating an address range of a logical block having a size coincidingwith that of a block as an erasing unit in the NAND memory 12. Acollection of a plurality of the logical blocks can be set as a logicalblock. Data in the physical NAND management layer 33 is managed byintra-NAND logical address-physical address conversion information(hereinafter, “logical-physical conversion information”) including acorrespondence relation between the intra-NAND logical address and theintra-NAND physical address in the NAND memory 12.

FIG. 6 illustrates an example of the logical NAND management information42 in tabular manner. FIG. 7 illustrates an example of intra-NANDlogical-physical conversion information 43 in tabular manner. As shownin FIG. 6, the logical NAND management information 42 includes logicalpage management information 42 a and logical block managementinformation 42 b. The logical page management information 42 a has oneentry for one logical area of a one page size. Each of entries includesan LBA of data of the one page size, an intra-NAND logical address, anda page flag indicating whether this page is valid. The logical blockmanagement information 42 b includes an intra-NAND physical address setfor an area of the one block size of the NAND memory 12. As shown inFIG. 7, in the intra-NAND logical-physical conversion information 43,the intra-NAND physical address and the inter-NAND logical address ofthe NAND memory 12 are associated.

By using these kinds of management information, a correspondence of theLBA used in the host apparatus, the intra-NAND logical address used inthe NAND memory 12, and the intra-NAND physical address used in the NANDmemory 12 can be established. This makes it is possible to exchange databetween the host apparatus and the memory system 10.

The management information managed by the DRAM management layer 31 islost because of power-off or the like so that this managementinformation can be called a volatile table. On the contrary, if themanagement information managed by the logical NAND management layer 32and the physical NAND management layer 33 is lost because of power-offor the like, the lost management information hinders successful startupof the memory system 10 so that measures are required to be taken suchthat the management information is stored even in the event of power-offor the like. Therefore, this management information can be called anonvolatile table.

This nonvolatile table manages data stored in the NAND memory 12. If thenonvolatile table is not present, information stored in the NAND memory12 cannot be accessed or data stored in an area is erased. Therefore,the nonvolatile table needs to be stored as latest information inpreparation for sudden power-off. Therefore, in the first embodiment,management information including at least the nonvolatile table isstored in the latest state in the management information storage area126 of the NAND memory 12. The management information storageinformation stored in the management information storage area 126 of theNAND memory 12 is explained below. The following explanation assumesthat only the nonvolatile table is stored in the management informationstorage area 126.

FIG. 8 is a schematic diagram of an example of contents of themanagement information storage information stored in the managementinformation storage area 126. Following items are stored in themanagement information storage area 126: management information storageinformation including a snapshot 210 as contents of the nonvolatiletable at a certain point, a pre-update log (hereinafter referred to aspre-log) 220A, which is update difference information of contents of thenonvolatile table before taking a snapshot next time and is acquiredbefore update, an post-update log (hereinafter referred to as post-log)220B, which is log information of contents same as those of the pre-log220A and is stored after the update, a second pointer 230 indicating theposition (a block) of the snapshot 210, the position (a block) of thepre-log 220A acquired for the snapshot 210, and the position (a block)of the post-log 220B acquired from the snapshot 210, and a root pointer240 indicating the position (a block) where the second pointer 230 isstored is stored. The snapshot 210 is information obtained by storingmanagement information including at least the nonvolatile table at apredetermined point among the management information stored in thetemporary storage area 111 of the DRAM 11.

The snapshot 210, the pre-log 220A, the post-log 220B, the secondpointer 230, and the root pointer 240 are stored in different blocks.The size of the blocks is the same as the size of a physical block as anerasing unit. The snapshot 210 is stored in a snapshot storing block.The snapshot 210 includes the logical NAND management information 42 andthe intra-NAND logical-physical conversion information 43 as nonvolatiletables in the management information storage area 126 of the NAND memory12. When a new snapshot 210 is stored, the snapshot 210 is stored in ablock different from that of the snapshot 210 stored before.

The pre-log 220A and the post-log 220B are difference informationbetween the nonvolatile table after contents are changed when there is achange in contents of the nonvolatile table and the snapshot 210 (or thesnapshot 210 and a log already generated) corresponding to the datawriting processing, etc. Specifically, a first pre-log 220A and a firstpost-log 220B after the snapshot 210 is taken are difference informationbetween the nonvolatile table and the snapshot 210. A second orsubsequent pre-log 220A after the snapshot 210 is taken is differenceinformation between a combination of the pre-log 220A already generatedand the snapshot 210 and the nonvolatile table. A second or subsequentpost-log 220B after the snapshot 210 is taken is difference informationbetween a combination of the post-log 220B already generated and thesnapshot 210 and the nonvolatile table.

The pre-log 220A is information generated before the managementinformation is actually updated. Therefore, before the managementinformation is actually updated by the execution of data writingprocessing or the like, the pre-log 220A is generated based on an updateschedule concerning how the management information is updated.

The post-log 220B is information generated after the managementinformation is actually updated. Therefore, the post-log 220B isgenerated by using the actual management information after themanagement information is actually updated according to the execution ofdata writing processing or the like.

The pre-log 220A and the post-log 220B are stored in log storing blocks,respectively. The pre-log 220A and the post-log 220B are written in thesame log storing blocks in a write-once manner even if a generation ofthe snapshot changes.

FIG. 9 depicts an example of a log. Because the pre-log 220A and thepost-log 220B have the same information, the pre-log 220A is explainedas an example of the log. The pre-log 220A includes target informationto be management information of a change target, a target entry as anentry to be a change target in the target information, a target item asan item to be a change target in the target entry, and change contentsas content of a change of the target item. The pre-log 220A and thepost-log 220B are reformed with storage of the new snapshot 210 becausethe pre-log 220A and the post-log 220B are update difference informationfor the snapshot 210.

The second pointer 230 is stored in a second pointer storing block. Thesecond pointer 230 only has to be a pointer that indicates a top addressof a block indicating storage positions of the snapshot 210, the pre-log220A, and the post-log 220B. The second pointer 230 is updated when thesnapshot 210 is stored anew or when a snapshot storing block or a logstoring block is changed. Pointers of the pre-log 220A and the post-log220B can be stored in the snapshot 210 instead to storing them in thesecond pointer storing block.

The second pointer 230 includes snapshot access information foraccessing the snapshot storing block, log access information foraccessing the log storing blocks for the pre-log 220A and the post-log220B, and a next pointer indicating a page position where the nextsecond pointer is stored. The second pointer 230 is changed toinformation in a linked list system by this next pointer. It is possibleto reach the latest second pointer 230 by tracking the next pointer fromthe top page of the second pointer storing block designated by the rootpointer 240. Instead of the linked list system, the second pointer 230can be stored in a write-once manner in order from the top page of thesecond pointer storage area.

The root pointer 240 is stored in a first root pointer storing block.The root pointer 240 is information for accessing the second pointerstoring block in which the second pointer 230 is stored and isinformation read first in processing for restoring the managementinformation when the memory system 10 is started. The root pointer 240is changed when the second pointer storing block is changed. The rootpointer 240 is stored in the root pointer storing block in a write-oncemanner in order from a top page of the block. In such a case, a pageimmediately preceding an unwritten page in the root pointer storingblock has latest information. Therefore, it is possible to retrieve thelatest root pointer 240 by retrieving a highest order page of theunwritten page. As in the case of the second pointer 230, it is alsopossible to use a linked list.

The root pointer 240 is stored in a fixed area 1261 in the NAND memory12. The snapshot 210, the pre-log 220A, the post-log 220B, and thesecond pointer 230 are stored in a variable area 1262 in the NAND memory12. The fixed area 1261 is a protected area in which a relation betweena logical block managed by the logical NAND management layer 32 and aphysical block managed by the physical NAND management layer 33 is fixedin the NAND memory 12 and is an area in which information necessary forrunning the memory system 10 and having a low update frequency in whichrewriting and writing hardly occurs is stored.

The variable area 1262 is an area in which the relation between thelogical block managed by the logical NAND management layer 32 and thephysical block managed by the physical NAND management layer 33 isvariable in an area of the NAND memory 12 excluding the fixed area 1261and is an area as a target of wear leveling.

Functions of the drive control unit 14 are explained below. FIG. 10 is ablock diagram of an example of a functional configuration of the drivecontrol unit 14. The drive control unit 14 includes a data managing unit141, an ATA-command processing unit 142, a security managing unit 143, aboot loader 144, an initialization managing unit 145, and a debugsupport unit 146. The data managing unit 141 performs data transferbetween the DRAM 11 and the NAND memory 12 and control of variousfunctions concerning the NAND memory 12. The ATA-command processing unit142 performs data transfer processing in cooperation with the datamanaging unit 141 based on an instruction received from an ATAinterface. The security managing unit 143 manages various kinds ofsecurity information in cooperation with the data managing unit 141 andthe ATA-command processing unit 142. The boot loader 144 loads, duringpower-on, various management programs (firmware) from the NAND memory 12to a not-shown memory (e.g., SRAM (Static RAM)). The initializationmanaging unit 145 performs initialization of controllers and circuits inthe drive control unit 14. The debug support unit 146 processes debugdata supplied from the outside via an RS232C interface.

FIG. 11 is a block diagram of an example of a functional configurationof the data managing unit 141. The data managing unit 141 includes adata-transfer processing unit 151, a management-information managingunit 152, and a management-information restoring unit 155. Thedata-transfer processing unit 151 performs data transfer between theDRAM 11 and the NAND memory 12. The management-information managing unit152 performs change and storage of management information according to achange of data stored in the DRAM 11 and the NAND memory 12. Themanagement-information restoring unit 155 restores latest managementinformation based on management information stored during power-on orthe like.

The management-information managing unit 152 includes amanagement-information writing unit 153 and a management-informationstoring unit 154. The management-information writing unit 153 performsupdate of the management information stored in the DRAM 11 when updateof the management information is necessary according to the changeprocessing for data stored in the DRAM 11 or the NAND memory 12 by thedata-transfer processing unit 151.

When the memory system 10 satisfies a predetermined condition, themanagement-information storing unit 154 stores, in the managementinformation storage area 126 of the NAND memory 12, the managementinformation as the snapshot 210, information to be updated in themanagement information as the pre-log 220A, and updated information inthe management information as the post-log 220B. When a position ofwriting in the second pointer 230 is changed according to storage of thesnapshot 210, the pre-log 220A, or the post-log 220B, themanagement-information storing unit 154 applies update processing to thesecond pointer 230.

Storing of the snapshot 210 is performed by the management-informationstoring unit 154 when a predetermined condition relating to the memorysystem 10 is satisfied. Storing of the snapshot 210 is performed, forexample, when a log storage area provided for storing a log 220 (thepre-log 220A and the post-log 220B) in the management informationstorage area 126 of the NAND memory 12 becomes full (i.e., the area iscompletely filled with data).

Storing of the log 220 (the pre-log 220A and the post-log 220B) isperformed by the management-information storing unit 154 during dataupdate (when data writing in the NAND memory 12 is necessary) on theNAND memory 12 involving update of the management information (thenonvolatile table) stored in the DRAM 11.

Timing when the management-information storing unit 154 stores thepre-log 220A and the post-log 220B is the time when update of themanagement information (the nonvolatile table) stored in the DRAM 11 isperformed by the management-information writing unit 153. Specifically,the pre-log 220A and the post-log 220B are stored before and afterprocessing for performing data writing and the like.

When the power supply of the memory system 10 is turned on, themanagement-information restoring unit 155 performs restorationprocessing for management information based on the managementinformation storage information stored in the management informationstorage area 126 of the NAND memory 12. Specifically, themanagement-information restoring unit 155 traces the root pointer 240 inthe fixed area 1261 and the second pointer 230, the snapshot 210, thepre-log 220A, and the post-log 220B in the variable area 1262 in orderand determines whether the pre-log 220A and the post-log 220Bcorresponding to the latest snapshot 210 are present. When the pre-log220A and the post-log 220B are not present, the management-informationrestoring unit 155 restores, in the DRAM 11, the snapshot 210 of thesnapshot storing block as management information. When the pre-log 220Aand the post-log 220B are present, it means that an abnormal end such asa program error or short break (abnormal isolation of the power supply)has occurred, the management-information restoring unit 155 acquires thesnapshot 210 from the snapshot storing block, acquires the pre-log 220Aand the post-log 220B from the log storing block, and performsrestoration of the management information (the nonvolatile table)reflecting the pre-log 220A and the post-log 220B on the snapshot 210 onthe DRAM 11.

Storage processing for the management information of the memory system10 by the management-information managing unit 152 is explained below.FIG. 12 is a flowchart of an example of a storage processing procedurefor the management information of the memory system 10. FIG. 13 is adiagram for explaining storage processing for the pre-log and thepost-log. It is assumed that the memory system 10 is connected to a hostapparatus and operates as a secondary storage device of the hostapparatus, the host apparatus (the memory system 10) is in a startupstate, and the snapshot 210 is stored before the stop of the memorysystem 10 before this startup state.

First, the host apparatus (the memory system 10) is in a started statebased on the snapshot 210 stored at the last end of the host apparatus(the memory system 10) (Step S11). Thereafter, data reading or writingfrom the host apparatus to the NAND memory 12 is performed whennecessary. The management-information managing unit 152 determineswhether a predetermined snapshot storage condition (e.g., the logstorage area is full (the area is full with log data)) is satisfied(Step S12). When the snapshot storage condition is not satisfied (“No”at Step S12), the management-information managing unit 152 determineswhether an instruction involving update of the management information(an instruction for data writing in the NAND memory) is received (StepS13). When the instruction involving update of the managementinformation is not received (“No” at Step S13), themanagement-information managing unit 152 returns to Step S12.

When the instruction involving update of the management information isreceived (“Yes” at Step S13), the management-information managing unit152 determines an update schedule indicating how the managementinformation is to be updated by executing the instruction (Step S14).The management-information managing unit 152 stores the update schedulein the log storing block of the management information storage area 126of the NAND memory 12 as the pre-log 220A (Step S15). When the pre-log220A is not stored in the log storing block, the update schedule (thelog) is difference information between the nonvolatile table at the timewhen the management information is updated and the snapshot 210 storedin the snapshot storing block. When the log 220 (hereinafter referred toas past pre-log 220A) is already stored in the log storing block, theupdate schedule (the log) is difference information between thenonvolatile table at the time when the management information is updatedand a combination of the snapshot 210 and the past pre-log 220A.Specifically, as shown in FIG. 13, before data writing (X) is performedas writing processing for Xth data, a pre-log (X) corresponding to thedata writing (X) is stored in the NAND memory 12 as the pre-log 220A. Atthis point, for example, the information y1 is stored as the pre-log220A. The pre-log 220A is stored in the management information storagearea 126 of the NAND memory 12, for example, after the pre-log 220A (theupdate schedule) is recorded on the DRAM 11.

Subsequently, the logical NAND management layer 32 executes theinstruction received at Step S13 (e.g., processing for writing (X) ofuser data in the data storage area 125 of the NAND memory 12) (StepS16).

Thereafter, the management information stored in the DRAM 11 is updatedaccording to the executed processing. The management-information storingunit 154 stores updated information in the management information in themanagement information storage area 126 of the NAND memory 12 as thepost-log 220B. When the post-log 220B is not stored in the log storingblock, the post-log 220B is difference information between thenonvolatile table at the present point and the snapshot 210 stored inthe snapshot storing block. When the post-log 220B (hereinafter referredto as past post-log 220B) is already stored in the log storing block,the post-log 220B is difference information between the nonvolatiletable at the present table and a combination of the snapshot 210 and apast log.

A post-log 220B (X) corresponding to the data writing (X) is stored inthe NAND memory 12 as the post-log 220B. At this point, for example, theinformation y1 is stored as the post-log 220B. The information y1 storedas the post-log 220B is the same as the information y1 stored as thepre-log 220A (Step S17). Thereafter, the management-information managingunit 152 returns to Step S12.

When the snapshot storage condition is not satisfied (“No” at Step S12)and when the instruction involving update of the management informationis received (“Yes” at Step S13), processing at Steps S14 to S17 isperformed. In other words, writing processing for (X+1)th data isperformed in the same manner as the writing processing for the Xth data.Before data writing (X+1) is performed as the writing processing for the(X+1)th data, a pre-log (X+1) corresponding to the data writing (X+1) isstored in the NAND memory 12 as the pre-log 220A. At this point, forexample, information y2 is stored as the pre-log 220A. The data writing(X+1) in the data storage area 125 in the NAND memory 12 is performed. Apost-log(X+1) corresponding to the data writing (X+1) is stored in theNAND memory 12 as the post-log 220B. At this point, for example, theinformation y2 is stored as the post-log 220B. The information y2 storedas the post-log 220B is the same as the information y2 stored as thepre-log 220A.

When the snapshot storage condition is satisfied at Step S12 (“Yes” atStep S12), the management-information managing unit 152 storesmanagement information including at least the nonvolatile table in thetemporary storage area 111 of the DRAM 11 in the management informationstorage area 126 of the NAND memory 12 as the snapshot 210 (Step S18).The management-information managing unit 152 determines whether the endof the memory system 10 is instructed (Step S19). When the end of thememory system 10 is not instructed, the management-information managingunit 152 returns to Step S12. When the end of the memory system 10 isinstructed, the processing is finished.

Restoration processing for management information of the memory system10 performed by the management-information restoring unit 155 isexplained below. FIG. 14 is a flowchart of an example of a restorationprocessing procedure for the management information of the memory system10. As in the above explanation, the memory system 10 is connected tothe host apparatus and operates as the second storage device of the hostapparatus.

First, the power supply of the host apparatus is turned on because of,for example, recovery from a short break, and a startup instruction isissued to the memory system 10 (Step S31). The management-informationrestoring unit 155 sequentially reads the root pointer 240 and thesecond pointer 230 in the management information storage area 126 of theNAND memory 12 (Step S32), acquires addresses of the blocks in which thesnapshot 210 and the pre and post logs (the pre-log 220A and thepost-lot 220B) are stored (Step S33), and acquires the snapshot 210(Step S34).

Thereafter, the management-information restoring unit 155 determineswhether a short break has occurred referring to the pre-log 220A and thepost-log 220B in the NAND memory 12 (Step S35). For example, when thepre-log 220A and the post-log 220B are present in the NAND memory 12,the management-information restoring unit 155 determines that a shortbreak has occurred. The determination on whether a short break hasoccurred can be performed by, for example, comparing the pre-log 220Aand the post-log 220B. In the first embodiment, the pre-log 220A and thepost-log 220B store the same information. Therefore, for example, whenthe number of pages stored as the pre-log 220A and the number of pagesstored as the post-log 220B do not coincide with each other, it meansthat a short break has occurred. The occurrence of a short break canalso be determined based on presence or absence of an ECC error, data ofa page stored as the pre-log 220A, and data of a page stored as thepost-log 220B.

When the short break has occurred (“Yes” at Step S35), themanagement-information restoring unit 155 checks, based on a latestpre-log 220A and a latest post-log 220B in the NAND memory 12, timingwhen the short break has occurred (Step S36).

Further, the management-information restoring unit 155 checks, based onthe latest pre-log 220A and the latest post-log 220B in the NAND memory12, timing when the short break has occurred (Step S36). Themanagement-information restoring unit 155 determines whether the timingwhen the short break has occurred is during storage of the post-log 220B(Step S37). For example, when a last page in the post-log 220B is beingwritten, this last page cannot be read out. Therefore, it is determinedthat the short break has occurred during storage of the post-log 220B.Further, because the short break has occurred during storage of thepost-log 220B, lower order page data breakage may have occurred in thepost-log 220B because of the short break. When a last page in thepre-log 220A is being written, this last page cannot be read out.Therefore, it is determined that the short break has occurred duringstorage of the pre-log 220A. Further, because the short break hasoccurred during storage of the pre-log 220A, lower order page databreakage may have occurred in the pre-log 220A because of the shortbreak. When a log is written in the last page in the pre-log 220A and alog is not written in the past page in the post-log 220B, it isdetermined that the short break has occurred during writing of data.

When the management-information restoring unit 155 determines that thetiming when the short break has occurred is during storage of thepost-log 220B (“Yes” at Step S37), the management-information restoringunit 155 selects the latest pre-log 220A (Step S38). On the other hand,when the management-information restoring unit 155 determines that thetiming when the short break has occurred is not during storage of thepost-log 220B (“No” at Step S37), the management-information restoringunit 155 stores the latest post-log 220B completed to be stored (StepS39). In other words, when the last page in the pre-log 220A is beingwritten or when a log is written in the last page in the pre-log 220Aand a log is not written in the last page in the post-log 220B, thelatest post-log 220B is selected.

Thereafter, the management-information restoring unit 155 acquires theselected log (the pre-log 220A or the post-log 220B) from the logstoring block and expands the log in the work area 112 of the DRAM 11(Step S40). The management-information restoring unit 155 restores themanagement information (the nonvolatile table) reflecting logs on thesnapshot 210 in order from oldest one (Step S41). Subsequently, themanagement-information restoring unit 155 applies recovery processing toa write-once block (a log storing block) in the NAND memory 12 (StepS42). The influence of suspended processing is eliminated by determiningpresence or absence of breakage of the write-once block in the NANDmemory 12 and performing the recovery processing. Presence or absence ofbreakage is determined by comparing a write-once state and contents ofthe management information with the write-once block. At a stage whenthe restoration of the management information and the recoveryprocessing ends, the management-information restoring unit 155 takes thesnapshot 210 again and stores the snapshot 210 in the managementinformation storage area 126 (Step S43). The management-informationrestoring unit 155 changes the snapshot and the log in the past to freeblocks (opens or discards the snapshot and the log) and the restorationprocessing for the management information is completed. The free blockmeans a block to which an application is not allocated yet. When anapplication is allocated to the free block, the free block is used afterbeing erased.

On the other hand, when short break has not occurred (“No” at Step S35),the management-information restoring unit 155 restores the managementinformation in the temporary storage area 111 of the DRAM 11 (Step S44)and the management information restoration processing ends.

The management-information restoring unit 155 can select, regardless ofpresence or absence of breakage of logs due to short break, one of thepre-log 220A and the post-log 220B and restore the managementinformation based on the number of pages stored as the pre-log 220A andthe number of pages stored as the post-log 220B. For example, when thenumber of pages stored as the pre-log 220A and the number of pagesstored as the post-log 220B are the same, the management-informationrestoring unit 155 selects the pre-log 220A and restores the managementinformation. When the number of pages stored as the pre-log 220A islarger than the number of pages stored as the post-log 220B, themanagement-information restoring unit 155 selects the post-log 220B andrestores the management information.

FIGS. 15A to 15D are diagrams of examples of a relation between data ina memory cell and a threshold voltage of the memory cell and order ofwriting in the NAND memory. First, the data in the memory cell is set to“0” when an erasing operation is performed. Subsequently, as shown inFIG. 15A, when writing in a lower order page is performed, the data inthe memory cell changes to data “0” and data “2”. As shown in FIG. 15B,before writing in a higher order page, data equal to or lower than athreshold voltage of actual data is written in an adjacent cell. Then, adistribution of a threshold voltage of the data “2” is expanded by thedata written in the cell. Thereafter, when data of the higher order pageis written, the data in the memory cell changes to data “0” to “3”having an original threshold voltage as shown in FIG. 15C. In the firstembodiment, the data in the memory cell is defined from low to highthreshold voltages.

Writing processing in the NAND memory 12 is explained. As shown in FIG.15D, a writing operation is performed for each of pages from a memorycell close to a source line in a block. In FIG. 15D, for convenience ofexplanation, four word lines are shown.

In first writing (indicated by encircled 1), 1-bit data is written in alower order page of a memory cell 1. In second writing (indicated byencircled 2), 1-bit data is written in a lower order page of a memorycell 2 adjacent to the memory cell 1 in a word direction. In thirdwriting (indicated by encircled 3), 1-bit data is written in a lowerorder page of a memory cell 3 adjacent to the memory cell 1 in a bitdirection. In fourth writing (indicated by encircled 4), 1-bit data iswritten in a lower order page of a memory cell 4 diagonally adjacent tothe memory cell 1.

In fifth writing (indicated by encircled 5), 1-bit data is written in ahigher order page of the memory cell 1. In sixth writing (indicated byencircled 6), 1-bit data is written in a higher order page of the memorycell 2 adjacent to the memory cell 1 in the word direction. In seventhwriting (indicated by encircled 7), 1-bit data is written in a lowerorder page of a memory cell 5 adjacent to the memory cell 3 in the bitdirection. In eighth writing (indicated by encircled 8), 1-bit data iswritten in a lower order page of a memory cell 6 diagonally adjacent tothe memory cell 3.

In ninth writing (indicated by encircled 9), 1-bit data is written in ahigher order page of the memory cell 3. In tenth writing (indicated byencircled 10), 1-bit data is written in a higher order page of thememory cell 4 adjacent to the memory cell 3 in the word direction. Ineleventh writing (indicated by encircled 11), 1-bit data is written in alower order page of a memory cell 7 adjacent to the memory cell 5 in thebit direction. In the twelfth writing (indicated by encircled 12), 1-bitdata is written in a lower order page of a memory cell 8 diagonallyadjacent to the memory cell 5.

In thirteenth writing (indicated by encircled 13), 1-bit data is writtenin a higher order page of the memory cell 5. In fourteenth writing(indicated by encircled 14), 1-bit data is written in a higher orderpage of the memory cell 6 adjacent to the memory cell 5 in the worddirection. In fifteenth writing (indicated by encircled 15), 1-bit datais written in a higher order page of the memory cell 7. In sixteenthwriting (indicated by encircled 16), 1-bit data is written in a higherorder page of the memory cell 8 adjacent to the memory cell 7 in theword direction.

A specific example of a selection method for logs used for restorationof management information is explained. FIGS. 16A to 17G are diagramsfor explaining the selection method for logs used for restoration ofmanagement information. In FIGS. 16A to 17G, a pre-log and a post-logare stored for each of pages in the block for a pre-log (a block on theleft side of each of the figures) and the block for a post-log (a blockon the right side of each of the figures). A page in one physical blockin FIGS. 16A to 17G corresponds to FIGS. 15A to 15D. In other words,pages 1 to 4, 7 to 8, and 11 to 12 are the lower order page shown inFIGS. 15A to 15D. Pages 5 to 6, 9 to 10, and 13 to 16 are the higherorder page shown in FIGS. 15A to 15D. In the block for a pre-log and theblock for a post-log, each of the rows in the blocks corresponds to onepage. In FIGS. 16A to 17G, the pages are separated into lower orderpages and higher order pages for convenience of explanation. Acombination of the lower order pages and the higher order pages form onephysical block.

In FIGS. 16A to 17G, a normally-stored log is indicated by a log x1, alog broken because of a short break is indicated by a log y1, and a logthat is currently being written is indicated by a log z1. Because ashort break has occurred during writing of the log z1 and the log y1 isbroken, a memory cell corresponding to a page of the log z1 and a memorycell corresponding to a page of the log y1 are the same. The page of thelog y1 is a page on a lower order side (a lower order page) and the pageof the log z1 is a page on a higher order side (a higher order page).Among logs (pages) of each of the blocks, encircled logs are logsselected as logs used for restoration of management information.

FIG. 16A is a diagram of the pre-log and the post-log at normal time(when abnormal isolation of the power supply does not occur and thepower supply is turned off). FIGS. 16B to 16D and FIGS. 17E to 17G arediagrams of the pre-log and the post-log at the time when short breakoccurs.

In FIG. 16A, the pre-log and the post-log stored in the NAND memory 12when the power supply of the memory system 10 is turned off withoutstoring the snapshot 210 are shown. In the case of FIG. 16A, becausedata is written in only the lower order pages (pages 1 to 4), even if ashort break occurs during writing in the lower order pages, lower orderpage data breakage does not occur. As shown in FIG. 16A, in the firstembodiment, the pre-log and the post-log are stored in the same page ofthe different blocks. Therefore, when the power supply is turned off atthe normal time, the last page of the pre-log and the last page of thepost-log are in the same page position. Therefore, in this case, themanagement information is restored by using the pre-log. At the normaltime shown in FIG. 16A, the management information can be restored byusing the post-log instead of the pre-log.

In FIG. 16B, a short break occurs while “log writing (1)” is performedas the pre-log. As shown in FIG. 16B, when the short break occurs duringwriting in the higher order page (page 6) of the pre-log, lower orderpage data breakage occurs in the lower order page (page 2 of thepre-log) corresponding to the higher order page being written. In otherwords, in the case of FIG. 16B, because the short break occurs duringstorage of the pre-log, the log y1 is generated in the block on thepre-log side. In this case, the log z1 (the log that is currently beingstored) corresponding to “log writing (1)” is stored in the block on thepre-log side. On the other hand, the post-log corresponding to “logwriting (1)” is not stored in the block on the post-log side. Therefore,the last page of the pre-log and the last page of the post-log containdifferent information. In this case, the management information isrestored by using the post-log.

In FIG. 16C, a short break occurs while “log writing (1)” is performedas the post-log. As shown in FIG. 16C, when the short break occursduring writing in the higher order page (page 6) of the post-log, lowerorder page data breakage occurs in the lower order page (page 2 of thepost-log) corresponding to the higher order page being written. In otherwords, in the case of FIG. 16C, because the short break occurs duringstorage of the post-log, the log y1 is generated in the block on thepost-log side. In this case, the log z1 corresponding to “log writing(1)” is stored in the block on the post-log side. The pre-logcorresponding to “log writing (1)” is already stored in the block on thepre-log side. Therefore, the last page of the pre-log and the last pageof the post-log are the same. In this case, the management informationis restored by using the pre-log.

In FIG. 16D, after “log writing (1)” is performed as the pre-log, anerror occurs during data writing corresponding to the pre-log. A shortbreak occurs while “log writing (2)” is performed as the pre-logcorresponding to rewriting processing of data writing. As shown in FIG.16D, when the short break occurs during writing in the higher order page(page 6) of the pre-log, lower order page data breakage occurs in thelower order page (page 2 of the pre-log) corresponding to the higherorder page being written. In other words, in the case of FIG. 16D,because the short break occurs during storage of the pre-log, the log y1occurs in the block on the pre-log side. In this case, the log x1corresponding to “log writing (1)” and the log z1 corresponding to “logwriting (2)” are stored in the block on the pre-log side. On the otherhand, the post-log corresponding to “log writing (1)” and the post-logcorresponding to “log writing (2)” are not stored in the block on thepost-log side. Therefore, the last page of the pre-log and the last pageof the post-log are different. In this case, the management informationis restored by using the post-log.

In FIG. 17E, after “log writing (1)” is performed as the pre-log, anerror occurs during data writing corresponding to the pre-log and “logwriting (2)” is performed as the pre-log corresponding to rewritingprocessing of data writing. Further, in FIG. 17E, after “log writing(2)” is performed as the post-log corresponding to rewriting processingof data writing, a short break occurs while “log writing (1)” isperformed as the post-log corresponding to first data writing. As shownin FIG. 17E, when the short break occurs during writing in the higherorder page (page 6) of the post-log, lower order page data breakageoccurs in the lower order page (page 2 of the post-log) corresponding tothe higher order page being written. In other words, in the case of FIG.17E, because the short break occurs during storage of the post-log, thelog y1 is generated in the block on the post-log side. In this case, thelog x1 corresponding to “log writing (1)” and the log x1 correspondingto “log writing (2)” are stored in the block on the pre-log side. On theother hand, the log x1 corresponding to “log writing (2)” and the log z1corresponding to “log writing (1)” are stored in the block on thepost-log side. Therefore, the last page of the pre-log and the last pageof the post-log are the same. The management information is restored byusing the pre-log.

In FIG. 17F, a short break occurs while “log writing (1)” over two pagesis performed as the pre-log. As shown in FIG. 17F, when the short breakoccurs during writing in the higher order pages (page 5 and page 6) ofthe pre-log, lower order page data breakage occurs in the lower orderpages (page 1 and page 2 of the post-log) corresponding to the higherorder pages being written. In other words, in the case of FIG. 17E,because the short break occurs during storage of the pre-log, the log y1(e.g., page 2) is generated in the block on the pre-log side. In thiscase, the log x1 (a pre-stage page) and the log z1 (a post-stage page)corresponding to “log writing (1)” are stored in the block on thepre-log side. On the other hand, the post-log corresponding to “logwriting (1)” is not stored in the block on the post-log side. Therefore,the last page of the pre-log and the last page of the post-log aredifferent. The management information is restored by using the post-log.

In FIG. 17G, a short break occurs while “log writing (1)” over two pagesis performed as the post-log. As shown in FIG. 17G, when the short breakoccurs during writing in the higher order pages (page 6 and page 7) ofthe post-log, lower order page data breakage occurs in the lower orderpages (page 1 and page 2 of the post-log) corresponding to the higherorder pages being written. In other words, in the case of FIG. 17G,because short break has occurred during storage of the post-log, the logy1 (e.g., page 2) is generated in the block on the post-log side. Inthis case, the log x1 and the log z1 corresponding to “log writing (1)”are stored in the block on the post-log side. The post-log correspondingto “log writing (1)” is already stored over two pages in the block onthe pre-log side. Therefore, the last page of the pre-log and the lastpage of the post-log are the same. The management information isrestored by using the pre-log.

In the first embodiment, when the memory system 10 is reset afterabnormal isolation of the power supply or the like, themanagement-information restoring unit 155 takes a snapshot again andstores the snapshot at a stage when the restoration of the managementinformation and the recovery processing are finished. Consequently,because the past log is opened, a log broken by the influence of shortbreak or the like does not remain. It is possible to improve reliabilityof the memory system 10.

Second Embodiment

FIG. 18 is a schematic diagram of an example of contents of managementinformation storage information stored in the management informationstorage area 126. The management information storage information storedin the management information storage area 126 includes the snapshot 210as contents of the nonvolatile table at a certain point, the log 220 asupdate difference information of the contents of the nonvolatile tableuntil a snapshot is taken next time, the second pointer 230 indicatingthe snapshot 210 and a position (a block) of the log 220 acquired firstconcerning this snapshot 210, and the root pointer 240 indicating aposition (a block) where the root pointer 240 is stored. The snapshot210 is information obtained by storing management information includingat least the nonvolatile table at a predetermined point among the kindsof management information stored in the temporary storage area 111 ofthe DRAM 11.

The snapshot 210, the log 220, the second pointer 230, and the rootpointer 240 are stored in different blocks, respectively. The size ofthe blocks is the same as the size of a physical block as an erasingunit. The snapshot 210 is stored in a snapshot storing block. Thesnapshot 210 includes the logical NAND management information 42 and theintra-NAND logical-physical conversion information 43 as nonvolatiletables in the management information storage area 126 of the NAND memory12. When a new snapshot 210 is stored, the snapshot 210 is stored in ablock different from that of the snapshot 210 stored before.

The log 220 is stored in a log storing block. When contents of thenonvolatile table are changed, the log 220 is difference informationbetween the nonvolatile table after the contents are changed and thesnapshot 210 (when a log is generated first after acquisition of thesnapshot 210) or difference information between the nonvolatile tableafter the contents are changed and the snapshot 210. The log 220 iswritten in the log storing block in page units in a write-once mannerevery time the log 220 is acquired as difference information. FIG. 9depicts an example of the log 220. The log 220 includes targetinformation to be management information of a change target, a targetentry as an entry to be a change target in the target information, atarget item as an item to be a change target in the target entry, andchange contents as content of a change of the target item. The log 220is reformed according to storage of the new snapshot 210 because the log220 is update difference information for the snapshot 210. In the secondembodiment, the pre-log and the post-log are described as “log” withoutdistinction. The same can apply when the pre-log and the post-log areacquired as in the first embodiment.

The second pointer 230 is stored in a second pointer storing block. Thesecond pointer 230 only has to be a pointer that indicates top addressesof blocks indicating storage positions of the snapshot 210 and the log220. The second pointer 230 is updated when the snapshot 210 is storedanew or when the snapshot storing block and the log storing block arechanged.

The second pointer 230 includes snapshot access information foraccessing the snapshot storing block, log access information foraccessing the log storing block, and a next pointer indicating a pageposition where the next second pointer is stored. The second pointer 230is changed to information in a linked list system by this next pointer.It is possible to reach the latest second pointer 230 by tracking thenext pointer from the top page of the second pointer storing blockdesignated by the root pointer 240. Instead of the linked list system,the second pointer 230 can be stored in a write-once manner in orderfrom the top page of the second pointer storage area. A pointerindicating a top address of the log 220 can be stored in the snapshot210. The second pointer 230 can include only a pointer indicating a topaddress of the snapshot 210.

The root pointer 240 is stored in a root pointer storing block. The rootpointer 240 is information for accessing the second pointer storingblock in which the second pointer 230 as the first pointer is stored andis information read first in processing for restoring the managementinformation when the memory system 10 is started. The first root pointer240 is changed when the second pointer storing block is changed. Theroot pointer 240 is stored in the root pointer storing block, forexample, in a write-once manner in order from a top page of the block.In such a case, a page immediately preceding an unwritten page in theroot pointer storing block has latest information. Therefore, it ispossible to retrieve the latest first root pointer 240 by retrieving ahighest order page of the unwritten page. As in the case of the secondpointer 230, it is also possible to use a linked list.

The root pointer 240 is stored in the fixed area 1261 in the NAND memory12. The snapshot 210, the log 220, and the second pointer 230 are storedin the variable area 1262 in the NAND memory 12. The fixed area 1261 isa protected area in which a relation between a logical block managed bythe logical NAND management layer 32 and a physical block managed by thephysical NAND management layer 33 is fixed in the NAND memory 12 and isan area in which information necessary for running the memory system 10having a low update frequency in which rewriting and writing hardlyoccurs is stored.

On the other hand, the variable area 1262 is an area in which therelation between the logical block managed by the logical NANDmanagement layer 32 and the physical block managed by the physical NANDmanagement layer 33 is variable in an area of the NAND memory 12excluding the fixed area 1261. The variable area 1262 is an area as atarget of wear leveling.

Functions of the drive control unit 14, a functional configuration ofthe data managing unit 141, and the like are the same as those in thefirst embodiment (see FIGS. 10 and 11). The management-informationmanaging unit 152 includes the management-information writing unit 153and the management-information storing unit 154. Themanagement-information writing unit 153 performs update of themanagement information stored in the DRAM 11 when update of themanagement information is necessary according to the change processingfor data stored in the DRAM 11 or the NAND memory 12 by thedata-transfer processing unit 151.

When the memory system 10 satisfies a predetermined condition, themanagement-information storing unit 154 stores, in the managementinformation storage area 126 of the NAND memory 12, the managementinformation as the snapshot 210 and information to be updated in themanagement information as the log 220. The management-informationstoring unit 154 also performs pointer update processing that isrequired according to the storage of the snapshot 210 or the log 220.

Storing of the snapshot 210 is performed by the management-informationstoring unit 154, for example, when any one of the following snapshotstorage conditions explained as examples below is satisfied:

(1) Standby (an instruction for minimizing power consumption of a mainbody of the memory system 10), sleep (an instruction for stopping adevice when there is no access during a predetermined time), or reset(an instruction for restarting the memory system 10) signal is received,and

(2) The log storage area provided for storing the log 220 in themanagement information storage area 126 of the NAND memory 12 becomesfull with data,

Timing when the management-information storing unit 154 stores the log220 is the time when update of the management information (thenonvolatile table) stored in the DRAM 11 is performed by themanagement-information writing unit 153 (when data writing in the NANDmemory 12 is necessary).

When the power supply of the memory system 10 is turned on, themanagement-information restoring unit 155 performs restorationprocessing for management information based on the managementinformation storage information stored in the management informationstorage area 126 of the NAND memory 12. Specifically, themanagement-information restoring unit 155 traces the root pointer 240,the second pointer 230, the snapshot 210, and the log 220 in order anddetermines whether the log 220 corresponding to the latest snapshot 210is present. When the log 220 is not present, the management-informationrestoring unit 155 restores, in the DRAM 11, the snapshot 210 of thesnapshot storing block as management information. When the log 220 ispresent, the management-information restoring unit 155 acquires thesnapshot 210 from the snapshot storing block, acquires the log 220 fromthe log storing block, and performs restoration of the managementinformation (the nonvolatile table) reflecting the log 220 on thesnapshot 210 on the DRAM 11. At this point, because it is likely thatthe memory system 10 does not end normally but ends abnormally becauseof short break or the like, the management-information restoring unit155 appropriately performs restoration of the management informationincluding determination of the end of the memory system 10.

As explained in (1) of the snapshot storage conditions, the memorysystem 10 can be set to store the snapshot 210 using themanagement-information storing unit 154 when the memory system 10receives the standby, sleep, or reset signal. In other words, the memorysystem 10 can be set to take the snapshot 210 again every time thememory system 10 receives the standby, sleep, or reset signal andthereafter shifts to a designated state (a standby, sleep, or resetstate). When the memory system 10 is set in this way, it is possible torestore the management information based on only the snapshot 210 duringrestart and it is unnecessary to refer to the log 220. Therefore, it ispossible to reduce start time.

On the other hand, if the snapshot 210 is taken again every time thestandby, sleep, or reset signal is received, for example, when thestandby signal or the like is received immediately after the snapshot210 is stored at a certain point, a situation in which the log length(size) of the log 220 stored during the signal reception is sufficientlyshort occurs. In such a case, regardless of the fact that there is onlya small change from the snapshot 210 stored before the reception of thestandby signal or the like, the snapshot 210 is taken again. Therefore,writing of the snapshot 210 is performed regardless of the fact thatcontents are updated only a little and writing efficiency falls. Becausethe snapshot 210 is content of the nonvolatile table, the size of thesnapshot 210 is large. Therefore, writing of the snapshot 210 takes timeand it takes long to shift to a designated state. Whereas the size ofthe snapshot is, for example, 8 MB, the size of a log acquired asdifference information is a page size (4 KB).

Further, if the snapshot 210 is always taken again every time thestandby, sleep, or reset signal is received, deterioration in the NANDmemory 12 worsens because of erasing of a block performed prior towriting. In this way, in the memory system 10 employing the NAND memory12, because the snapshot 210 is taken again every time the standbysignal or the like is received, there is a problem due to thecharacteristic of the NAND memory 12 that the durable life of the memorysystem 10 is reduced in addition to the characteristic that waiting timeuntil shifting to a designated state is long.

Therefore, in the second embodiment, when the standby, sleep, or resetsignal is received, it is possible to select to take the snapshot 210again and shift to a designated state or to shift to the designatedstate without taking the snapshot 210 again. Specifically, themanagement-information storing unit 154 receives the standby signal orthe like and performs switching to any one of the types of the shiftaccording to, for example, whether the log 220 is stored in themanagement information storage area 126 and, when the log 220 is stored,according to the log length (size) of the log 220.

FIG. 19A is a timechart of shifting to a standby state without taking asnapshot again and FIG. 19B is a timechart of shifting to the standbystate after taking the snapshot again when a standby signal is received.In FIGS. 19A and 19B, the standby signal is shown as an example.However, the same applies in the sleep and reset signals.

In a situation shown in FIG. 19A, because the condition (2) of thesnapshot storage conditions is satisfied, the snapshot 210 is acquiredand, subsequently, logs 51-1 to 51-n, where “n” is an integer equal toor larger than 1, are sequentially acquired according to update ofcontents of the nonvolatile table. The logs 51-1 to 51-n aresequentially written in the log storing block in a write-once manner inpage units and stored as the log 220. FIG. 20 is a diagram of a state inwhich logs are stored in page units in the log storing block. In FIG.20, among the components shown in FIG. 18, only the second pointer 230,the snapshot 210, and the log 220 are shown for the sake of simplicity.The log 220 includes the logs 51-1 to 51-n sequentially written in awrite-once manner from a top page to an n page in the log storing block.

Further, following the storage of the log 51-n, although the standbysignal is generated, the management-information storing unit 154 shiftsto the standby state without taking a snapshot again (standby occurs).When the standby is released, the memory system 10 starts from thestandby state. The management-information restoring unit 155 acquiresthe snapshot 210 from the snapshot storing block of the managementinformation storage area 126, acquires the log 220 from the log storingblock of the management information storage area 126, and restores themanagement information (the nonvolatile table) reflecting the log 220 onthe snapshot 210 on the DRAM 11.

In FIG. 19B, the storage of the snapshot 210 and the logs 51-1 to 51-nand the generation of the standby signal are the same as those shown inFIG. 19A. However, the management-information storing unit 154 takes asnapshot 55 again after the generation of the standby signal. When thesnapshot 55 is stored, the second pointer 230 is updated. The secondpointer 230 indicates a top address of the snapshot 55 and indicates atop address of a log storing block for the snapshot 55 secured anew.When the management-information storing unit 154 takes the snapshot 55again, the management-information storing unit 154 immediately shifts tothe standby state (standby occurs). Therefore, a log is not stored inthe log storing block for the snapshot 55. When the standby is released,the memory system 10 starts from the standby state. Themanagement-information restoring unit 155 acquires the snapshot 55 fromthe snapshot storing block of the management information storage area126 and restores the management information (the nonvolatile table)based on the snapshot 55 on the DRAM 11.

In the second embodiment, the management-information storing unit 154performs the switching according to, for example, the log length (size)of the log 220 stored in the management information storage area 126.When the log length (size) is equal to or larger than a predeterminedsize, the management-information storing unit 154 takes a snapshot again(FIG. 19B). When the log length (size) is smaller than the predeterminedsize, the management-information storing unit 154 does not take asnapshot again (FIG. 19A). In FIGS. 19A, 19B, and 20, the log length(size) of the log 220 is a total of the sizes of the logs 51-1 to 51-nand is a size for n pages. Therefore, the management-information storingunit 154 can perform switching to take a snapshot again and to not takea snapshot again by comparing n and the number of switching referencepages (nth).

The number of switching reference pages nth can be determined, forexample, with the method explained below. In FIG. 19A, because asnapshot is not taken again after the generation of the standby signal,shifting time to the standby state is short. On the other hand, duringrestoration of the management information after the release of thestandby, it is necessary to read out the logs 51-1 to 51-n in additionto the snapshot 210. When n is larger, longer time is required forrestoration. Conversely, when n is sufficiently small, a differencebetween time for restoring the management information based on thesnapshot 210 and the logs 51-1 to 51-n and time for restoring themanagement information based on the snapshot 55 (FIG. 19B) is small.Therefore, the selection of the case shown in FIG. 19A is advantageouswhen n is smaller.

In general, start time of the memory system 10 depends on thespecification of the system. Therefore, when restoration takes time andstart time exceeds the specification of the system because n is large,the case shown in FIG. 19A cannot be selected. In other words, thenumber of switching reference pages nth is a value with which start timein the case shown in FIG. 19A satisfies the specification of the systemwhen n is smaller than this value.

In FIG. 19B the snapshot 55 is taken again after the generation of thestandby signal. Therefore, because of the writing time for the snapshot55, in addition to the fact that the shifting time to the standby stateis long, writing efficiency falls when n is small. Therefore, it can besaid that the selection of the case shown in FIG. 19B is advantageouswhen n is larger. Therefore, taking into account the case shown in FIG.19A as well, it is preferable to select the case shown in FIG. 19B whenn is equal to or larger than the number of switching reference pagesnth.

FIG. 21 is a flowchart for explaining operations of themanagement-information storing unit 154 during standby, sleep, or reset.

The management-information storing unit 154 determines presence orabsence of any of a standby, sleep, or reset signal (Step S21). Whenthere is no input of the standby, sleep, or reset signal (No at StepS21), the management-information storing unit 154 performs otherprocessing (Step S22) and returns to Step S21. When it is determined atStep S21 that any of the standby, sleep, or reset signal is input (Yesat Step S21), the management-information storing unit 154 determineswhether the log length is equal to or larger than the predetermined size(Step S23). When it is determined that the log length is equal to orlarger than the predetermined size (Yes at Step S23), themanagement-information storing unit 154 takes a new snapshot (Step S14)and finishes the processing. When it is determined that the log lengthis smaller than the predetermined size (No at Step S23), themanagement-information storing unit 154 finishes the processing withouttaking a new snapshot. Thereafter, the memory system 10 changes to astate corresponding to the standby, sleep, or reset signal.

According to the second embodiment, when the standby, sleep, or resetsignal is received, the management-information storing unit 154determines whether the log length is equal to or larger than thepredetermined size and determines to take a snapshot again and shift toa designated state or to shift to the designated state without taking asnapshot again. Therefore, because it is unnecessary to take a snapshotagain every time the standby, sleep, or reset signal is received, it ispossible to reduce the number of times of writing in the NAND memory 12and suppress the durable life of the NAND memory 12 from being reduced.There is also an effect that it is possible to reduce time forrestoration of the management information by the management-informationrestoring unit 155.

In the above explanation, the data management unit in the DRAM 11 is thepage size unit, the data writing and readout unit in the NAND memory 12is the page size unit, and the erasing unit and the management unit arethe block size unit. However, this does not mean that the datamanagement unit, the data writing and readout unit, and the erasing unitand the management unit are limited to these size units. Arbitrary unitscan be used as the data management unit, the data writing and readoutunit, and the erasing unit and the management unit.

The charge accumulating layer is not limited to the floating gate typeand can be a charge trap type including a silicon nitride film such asthe MONOS (Metal-Oxide-Nitride-Oxide-Semiconductor) structure and othersystems.

As explained above, according to the present invention, there is aneffect that it is possible to eliminate likelihood that a log is brokenafter reset from abnormal isolation of a power supply and improvereliability of management information.

According to the present invention, when the standby, sleep, or resetsignal is received, it is possible to shift to a designated statewithout taking a snapshot again and thereafter return to a state beforethe shift. Therefore, there is an effect that it is unnecessary to takea snapshot every time the standby, sleep, or reset signal is receivedand it is possible to reduce the number of times of writing in a memorycell in which multi-value data can be stored and suppress the durablelife of the memory cell from being reduced.

Additional advantages and modifications will readily occur to thoseskilled in the art. Therefore, the invention in its broader aspects isnot limited to the specific details and representative embodiments shownand described herein. Accordingly, various modifications may be madewithout departing from the spirit or scope of the general inventiveconcept as defined by the appended claims and their equivalents.

1-20. (canceled)
 21. A memory system comprising: a nonvolatile memory; amemory controller configured to perform data management in thenonvolatile memory based on one part of first management information,wherein the memory controller includes: a management-information storingunit configured to store a first log created before updating the firstmanagement information and a second log created after updating the firstmanagement information, and to store the first management information inthe nonvolatile memory as second management information; and in a caseof a power cut, the management-information storing unit is configured tostore the first management information as third management informationin the nonvolatile memory.
 22. The memory system according to claim 21,wherein the management-information storing unit is configured toinvalidate the log after storing the third management information in thenonvolatile memory.
 23. The memory system according to claim 21, whereinthe nonvolatile memory includes a plurality of blocks, each one of theplurality of blocks being a data erasing unit and including a pluralityof pages, each one of the plurality of pages being a data programmingunit, and the management-information storing unit is configured to storethe log by a page unit in each one of the plurality of blocks.
 24. Thememory system according to claim 21, wherein the first log and thesecond log have same contents as each other.
 25. The memory systemaccording to claim 21, wherein the nonvolatile memory is a NAND flashmemory.
 26. A memory system comprising: a nonvolatile memory; a memorycontroller configured to perform data management based on managementinformation, wherein the memory controller configured to: store a firstlog created before updating the management information and a second logcreated after updating the management information, and to store themanagement information in the nonvolatile memory; and in a case of apower cut, store the updated management information and a log stored inthe nonvolatile memory and to store the management information in thenonvolatile memory.
 27. A method of controlling a memory systemcomprising: managing the data by using first management information; andstoring a first log created before updating the first managementinformation and a second log created after updating the first managementinformation; storing the first management information in the memory assecond management information; and in a case of having an error in thememory system, storing the first management information as thirdmanagement information.
 28. The method according to claim 27, furthercomprising: invalidating the log after storing the third managementinformation in the memory.
 29. The method according to claim 27, whereinthe memory includes a plurality of blocks, each one of the plurality ofblocks being a data erasing unit and including a plurality of pages,each one of the plurality of pages being a data programming unit, andfurther comprising: storing the log by a page unit in each one of theplurality of blocks.
 30. The method according to claim 27, wherein thefirst log and the second log have same contents as each other.
 31. Themethod according to claim 27, wherein the memory is a NAND flash memory.